<template>
    <div class="login-box">
        <div class="login">
            <h1>基座登录</h1>
            <div class="username">
                <el-input v-model="accountData.username" placeholder="请输入用户名" />
            </div>
            <div class="password">
                <el-input v-model="accountData.password" placeholder="请输入密码" />
            </div>
            <div class="btn">
                <el-button type="primary" @click="hanldeLogin">登录</el-button>
            </div>
        </div>
    </div>
</template>
<script setup lang="ts">
import { ElMessage } from 'element-plus';
import { ref } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const accountData = ref({
    username: '',
    password: ''
})
const hanldeLogin = () => {
    console.log(accountData.value, 'accountData')
    if (accountData.value.username && accountData.value.password) {
        router.push({
            path: '/home'
        })
    } else {
        return ElMessage.error('请输入账号密码')
    }
}
</script>
<style lang="scss">
.login-box {
    height: 100%;
    position: relative;
}

.login {
    width: 600px;
    height: 400px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 10px;
    border: 1px solid var(--el-border-color);


    &>div {
        height: 40px;
        line-height: 40px;
        padding: 10px;
        margin-bottom: 30px;
    }

    h1 {
        text-align: center;
        line-height: 80px;
    }

    .btn {
        text-align: center;
    }
}
</style>